{{!-- 异常处理 --}}
{{#if logicNodeModel.exceptionLinkModel}}
try {
    {{>getRawSQLCall logicNodeModel = logicNodeModel}}
}
catch (Exception e) {
    {{camelCase exceptionLinkModel.dstPSDELogicNode.codeName}}()
}
{{else}}
    {{>getRawSQLCall logicNodeModel = logicNodeModel}}
{{/if}}
{{!-- 主逻辑 --}}
{{#*inline "getRawSQLCall"}}
Map param = new HashMap();
{{#if logicNodeModel.pSDELogicNodeParams}}
    {{#each logicNodeModel.pSDELogicNodeParams as |nodeParam|}}
        {{#if (eq nodeParam.srcValueType "SRCDLPARAM")}}
param.put("param{{@index}}",_{{lowerCase nodeParam.srcPSDELogicParam.codeName}}.get("{{lowerCase nodeParam.srcFieldName}}"));
        {{else if (eq nodeParam.srcValueType "WEBCONTEXT")}}
param.put("param{{@index}}",_default.get("{{lowerCase nodeParam.srcFieldName}}"));
        {{else if (eq nodeParam.srcValueType "APPDATA")}}
//暂未支持应用数据
        {{else if (eq nodeParam.srcValueType "APPLICATION")}}
//暂未支持应用数据
        {{else if (eq nodeParam.srcValueType "SESSION")}}
param.put("param{{@index}}",_srfuser.getSessionParams().get("{{lowerCase nodeParam.srcFieldName}}"));
        {{else if (eq nodeParam.srcValueType "DATACONTEXT")}}
param.put("param{{@index}}",_default.get("{{lowerCase nodeParam.srcFieldName}}"));
        {{else if (eq nodeParam.srcValueType "ENVPARAM")}}
//暂未支持环境参数
        {{else if (eq nodeParam.srcValueType "VIEWPARAM")}}
//暂未支持视图参数
        {{else if (eq nodeParam.srcValueType "NONE")}}
param.put("param{{@index}}", null);
        {{else if (eq nodeParam.srcValueType "NULLVALUE")}}
param.put("param{{@index}}", null);
        {{else if (eq nodeParam.srcValueType "SRCVALUE")}}
param.put("param{{@index}}", "{{lowerCase nodeParam.srcValue}}"));
        {{/if}}
    {{/each}}
{{/if}}
String strSql = "{{logicNodeModel.rawSql}}";
{{#if logicNodeModel.isFillDstLogicParam}}
{{!-- 返回结果 --}}
    {{>getRawSQLCallResult logicNodeModel = logicNodeModel}}
{{else}}
{{!-- 无返回结果 --}}
_{{lowerCase logicNodeModel.entity.codeName}}service.execute(strSql,param);
{{/if}}
{{/inline}}
{{#*inline "getRawSQLCallResult"}}
{{!-- 将返回结果填充至逻辑参数 --}}
java.util.List<JSONObject> entities = _{{lowerCase logicNodeModel.entity.codeName}}service.select(strSql,param);
if(!ObjectUtils.isEmpty(entities)){
{{!-- 返回参数是列表变量 --}}
{{#if logicNodeModel.dstPSDELogicParam.entityListParam}}
    for(JSONObject entity : entities){
        _{{lowerCase logicNodeModel.dstPSDELogicParam.codeName}}.add(entity);
    }
{{!-- 返回参数有实体对象 --}}
{{else if logicNodeModel.dstPSDELogicParam.paramPSDataEntity}}
    JSONObject entity = entities.get(0);
    for (Map.Entry entry : entity.entrySet()) {
        _{{lowerCase logicNodeModel.dstPSDELogicParam.codeName}}.set(String.valueOf(entry.getKey()),entry.getValue());
    }
{{!-- 返回参数无实体对象，按map处理 --}}
{{else}}
    JSONObject entity = entities.get(0);
    _{{lowerCase logicNodeModel.dstPSDELogicParam.codeName}}.putAll(entity);
{{/if}}
}
{{/inline}}